Skip to main content

All Questions

4votes
1answer
567views

Is this Wikipedia pseudocode for in-order generic tree traversal correct?

Wikipedia states that the following algorithm works for any tree (not necessarily binary trees) Perform pre-order operation For each i (with i = 1 to n) do: Visit i-th, if present ...
9a3eedi's user avatar
  • 2,099
1vote
1answer
2kviews

In which of the following tree traversal all the child nodes are visited first before the parent node [closed]

In an n-ary tree... Given a reference to some child node And a reference to a distant parent of the referenced child node Is there a method that a parent node can use to figure out which of its ...
Eric's user avatar
  • 113
22votes
4answers
44kviews

Is Pre-Order traversal same as Depth First Search?

It seems to me like pre-order traversal and DFS are same as in both the cases we traverse from root till the left branch and back to root and then to the right branch recursively. Could any please ...
Srikanth Kandalam's user avatar
13votes
3answers
26kviews

Usefulness of pre and post order traversal of binary trees

This may be very naive, but I was wondering, it the context of binary trees (plain, sorted and balanced), of all the traversal types: depth-first pre-order depth-first in-order depth-first post-order ...
Shivan Dragon's user avatar

close